/*
 * car_maintenance_struct.cpp
 *
 *  Created on: Jul 18, 2009
 *      Author: user
 */

#include "car_maintenance_struct_csv.hpp"
#include "type_conversion.hpp"

car_maintenance_struct_csv::car_maintenance_struct_csv(std::vector<std::string> const& v)
{

	   switch(v.size()-1)
 	   {
		case NOTE:
			this->set_notes(v[NOTE]);
		case PLATE_ID:
			this->set_plateId(type_conversion<int>::to_number(v[PLATE_ID]));
		case AMOUNT:
			this->set_totalAmount(type_conversion<double>::to_number(v[AMOUNT]));
		case DATE:
			this->set_maintenanceDate(date_input_string::to_date(v[DATE]));
		case ID:
			this->set_maintenanceId(type_conversion<int>::to_number(v[ID]));
			break;
		default: break;
	   }

		std::cout << "[car_maintenance_struct_csv.car_maintenance_struct] " << *this << std::endl;
}

